summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Simons <kevin.simons@nokia.com>2012-04-01 20:52:52 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-10 18:43:10 +0200
commit52786ac08e0b6c768a006f5bdc5d454d0afb5416 (patch)
treec0b3f61ad5202f9cb7e9848977cd1e24eb98d235
parent4921803cb9b3ed1341b5cc97ae7258182e5057e9 (diff)
Split partition handling out into a separate module
This is a brute force attempt to create a jsondbpartition module which can be used by the daemon, by autotests and by the client for private partitions. Most of the classes were largely unmodified by this change (with the exception of namespace and symbol exports). JsonDbManagedBtree was somewhat reworked in order not to expose QBtree as part of this module. Overall, the number of headers exposed by this module is far too large currently. Subsequent patches are needed to refine the APIs of this module, to make all the headers private and to overall reduce the number of headers provided. Change-Id: I6deaf32960102f9d3efcb290edd82381597657aa Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
-rw-r--r--modules/qt_jsondbpartition.pri18
-rw-r--r--src/clientcompat/clientcompat.pro3
-rw-r--r--src/clientcompat/jsondb-client.cpp2
-rw-r--r--src/clientcompat/jsondb-connection.cpp2
-rw-r--r--src/clientcompat/jsondb-strings.cpp117
-rw-r--r--src/common/common.pri20
-rw-r--r--src/common/jsondb-error.h42
-rw-r--r--src/common/jsondb-strings.h42
-rw-r--r--src/daemon/daemon.pri55
-rw-r--r--src/daemon/daemon.pro14
-rw-r--r--src/daemon/dbserver.cpp8
-rw-r--r--src/daemon/dbserver.h7
-rw-r--r--src/daemon/jsondbephemeralpartition.cpp8
-rw-r--r--src/daemon/jsondbephemeralpartition.h8
-rw-r--r--src/daemon/jsondbsignals.cpp2
-rw-r--r--src/daemon/jsondbsignals.h2
-rw-r--r--src/daemon/main.cpp7
-rw-r--r--src/partition/jsondb.qrc (renamed from src/daemon/jsondb.qrc)0
-rw-r--r--src/partition/jsondbcollator.cpp (renamed from src/common/jsondbcollator.cpp)4
-rw-r--r--src/partition/jsondbcollator.h (renamed from src/common/jsondbcollator.h)8
-rw-r--r--src/partition/jsondbcollator_p.h (renamed from src/common/jsondbcollator_p.h)4
-rw-r--r--src/partition/jsondberrors.cpp98
-rw-r--r--src/partition/jsondberrors.h (renamed from src/common/jsondb-global.h)48
-rw-r--r--src/partition/jsondbindex.cpp (renamed from src/daemon/jsondbindex.cpp)39
-rw-r--r--src/partition/jsondbindex.h (renamed from src/daemon/jsondbindex.h)34
-rw-r--r--src/partition/jsondbindexquery.cpp (renamed from src/daemon/jsondbindexquery.cpp)7
-rw-r--r--src/partition/jsondbindexquery.h (renamed from src/daemon/jsondbindexquery.h)7
-rw-r--r--src/partition/jsondbmanagedbtree.cpp (renamed from src/daemon/jsondbmanagedbtree.cpp)65
-rw-r--r--src/partition/jsondbmanagedbtree.h (renamed from src/daemon/jsondbmanagedbtree.h)41
-rw-r--r--src/partition/jsondbmanagedbtreetxn.cpp (renamed from src/daemon/jsondbmanagedbtreetxn.cpp)5
-rw-r--r--src/partition/jsondbmanagedbtreetxn.h (renamed from src/daemon/jsondbmanagedbtreetxn.h)8
-rw-r--r--src/partition/jsondbmapdefinition.cpp (renamed from src/daemon/jsondbmapdefinition.cpp)10
-rw-r--r--src/partition/jsondbmapdefinition.h (renamed from src/daemon/jsondbmapdefinition.h)6
-rw-r--r--src/partition/jsondbnotification.cpp (renamed from src/daemon/jsondbnotification.cpp)6
-rw-r--r--src/partition/jsondbnotification.h (renamed from src/daemon/jsondbnotification.h)8
-rw-r--r--src/partition/jsondbobject.cpp (renamed from src/daemon/jsondbobject.cpp)6
-rw-r--r--src/partition/jsondbobject.h (renamed from src/daemon/jsondbobject.h)9
-rw-r--r--src/partition/jsondbobjectkey.h (renamed from src/daemon/jsondbobjectkey.h)14
-rw-r--r--src/partition/jsondbobjecttable.cpp (renamed from src/daemon/jsondbobjecttable.cpp)20
-rw-r--r--src/partition/jsondbobjecttable.h (renamed from src/daemon/jsondbobjecttable.h)9
-rw-r--r--src/partition/jsondbobjecttypes_impl_p.h (renamed from src/daemon/jsondbobjecttypes_impl_p.h)6
-rw-r--r--src/partition/jsondbobjecttypes_p.h (renamed from src/daemon/jsondbobjecttypes_p.h)8
-rw-r--r--src/partition/jsondbowner.cpp (renamed from src/daemon/jsondbowner.cpp)8
-rw-r--r--src/partition/jsondbowner.h (renamed from src/daemon/jsondbowner.h)9
-rw-r--r--src/partition/jsondbpartition.cpp (renamed from src/daemon/jsondbpartition.cpp)12
-rw-r--r--src/partition/jsondbpartition.h (renamed from src/daemon/jsondbpartition.h)13
-rw-r--r--src/partition/jsondbpartitionglobal.h71
-rw-r--r--src/partition/jsondbproxy.cpp (renamed from src/daemon/jsondbproxy.cpp)8
-rw-r--r--src/partition/jsondbproxy.h (renamed from src/daemon/jsondbproxy.h)10
-rw-r--r--src/partition/jsondbquery.cpp (renamed from src/daemon/jsondbquery.cpp)6
-rw-r--r--src/partition/jsondbquery.h (renamed from src/daemon/jsondbquery.h)16
-rw-r--r--src/partition/jsondbreducedefinition.cpp (renamed from src/daemon/jsondbreducedefinition.cpp)10
-rw-r--r--src/partition/jsondbreducedefinition.h (renamed from src/daemon/jsondbreducedefinition.h)6
-rw-r--r--src/partition/jsondbschemamanager_impl_p.h (renamed from src/daemon/jsondbschemamanager_impl_p.h)4
-rw-r--r--src/partition/jsondbschemamanager_p.h (renamed from src/daemon/jsondbschemamanager_p.h)6
-rw-r--r--src/partition/jsondbscriptengine.cpp (renamed from src/daemon/jsondbscriptengine.cpp)6
-rw-r--r--src/partition/jsondbscriptengine.h (renamed from src/daemon/jsondbscriptengine.h)7
-rw-r--r--src/partition/jsondbsettings.cpp (renamed from src/daemon/jsondbsettings.cpp)6
-rw-r--r--src/partition/jsondbsettings.h (renamed from src/daemon/jsondbsettings.h)8
-rw-r--r--src/partition/jsondbstat.h (renamed from src/daemon/jsondbstat.h)8
-rw-r--r--src/partition/jsondbstrings.cpp (renamed from src/common/jsondb-strings.cpp)6
-rw-r--r--src/partition/jsondbstrings.h126
-rw-r--r--src/partition/jsondbview.cpp (renamed from src/daemon/jsondbview.cpp)10
-rw-r--r--src/partition/jsondbview.h (renamed from src/daemon/jsondbview.h)8
-rw-r--r--src/partition/partition.pro80
-rw-r--r--src/partition/schema-validation/checkpoints.h (renamed from src/daemon/schema-validation/checkpoints.h)0
-rw-r--r--src/partition/schema-validation/object.h (renamed from src/daemon/schema-validation/object.h)0
-rw-r--r--src/partition/schema/Capability.json (renamed from src/daemon/schema/Capability.json)0
-rw-r--r--src/partition/schema/Index.json (renamed from src/daemon/schema/Index.json)0
-rw-r--r--src/partition/schema/RootCapability.json (renamed from src/daemon/schema/RootCapability.json)0
-rw-r--r--src/partition/schema/View.json (renamed from src/daemon/schema/View.json)0
-rw-r--r--src/partition/schema/notification.json (renamed from src/daemon/schema/notification.json)0
-rw-r--r--src/src.pro2
-rw-r--r--sync.profile2
-rw-r--r--tests/auto/accesscontrol/accesscontrol.pro4
-rw-r--r--tests/auto/accesscontrol/testjsondb.cpp2
-rw-r--r--tests/auto/daemon/daemon.pro10
-rw-r--r--tests/auto/daemon/testjsondb.cpp8
-rw-r--r--tests/auto/queries/queries.pro5
-rw-r--r--tests/auto/queries/testjsondbqueries.cpp6
-rw-r--r--tests/benchmarks/daemon/bench_daemon.cpp6
-rw-r--r--tests/benchmarks/daemon/daemon.pro5
82 files changed, 886 insertions, 435 deletions
diff --git a/modules/qt_jsondbpartition.pri b/modules/qt_jsondbpartition.pri
new file mode 100644
index 00000000..f68597a1
--- /dev/null
+++ b/modules/qt_jsondbpartition.pri
@@ -0,0 +1,18 @@
+!win32 {
+QT.jsondbpartition.VERSION = 1.0.0
+QT.jsondbpartition.MAJOR_VERSION = 1
+QT.jsondbpartition.MINOR_VERSION = 0
+QT.jsondbpartition.PATCH_VERSION = 0
+
+QT.jsondbpartition.name = QtJsonDbPartition
+QT.jsondbpartition.bins = $$QT_MODULE_BIN_BASE
+QT.jsondbpartition.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtJsonDbPartition
+QT.jsondbpartition.private_includes = $$QT_MODULE_INCLUDE_BASE/QtJsonDbPartition/$$QT.jsondbpartition.VERSION
+QT.jsondbpartition.sources = $$QT_MODULE_BASE/src
+QT.jsondbpartition.libs = $$QT_MODULE_LIB_BASE
+QT.jsondbpartition.plugins = $$QT_MODULE_PLUGIN_BASE
+QT.jsondbpartition.imports = $$QT_MODULE_IMPORT_BASE
+QT.jsondbpartition.depends = core network qml
+
+QT_CONFIG += jsondbpartition
+}
diff --git a/src/clientcompat/clientcompat.pro b/src/clientcompat/clientcompat.pro
index c5b8f05b..7edadedb 100644
--- a/src/clientcompat/clientcompat.pro
+++ b/src/clientcompat/clientcompat.pro
@@ -38,6 +38,7 @@ SOURCES += \
jsondb-connection.cpp \
jsondb-query.cpp \
jsondb-oneshot.cpp \
- jsondb-notification.cpp
+ jsondb-notification.cpp \
+ jsondb-strings.cpp
mac:QMAKE_FRAMEWORK_BUNDLE_NAME = $$QT.jsondbcompat.name
diff --git a/src/clientcompat/jsondb-client.cpp b/src/clientcompat/jsondb-client.cpp
index bf4e7939..4a9e69ac 100644
--- a/src/clientcompat/jsondb-client.cpp
+++ b/src/clientcompat/jsondb-client.cpp
@@ -41,7 +41,7 @@
#include "jsondb-client.h"
#include "jsondb-client_p.h"
-#include "jsondb-strings.h"
+#include "jsondb-strings_p.h"
#include "jsondb-connection_p.h"
diff --git a/src/clientcompat/jsondb-connection.cpp b/src/clientcompat/jsondb-connection.cpp
index 78899df5..8d72f22a 100644
--- a/src/clientcompat/jsondb-connection.cpp
+++ b/src/clientcompat/jsondb-connection.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "jsondb-strings.h"
+#include "jsondb-strings_p.h"
#include "jsondb-error.h"
#include "jsondb-oneshot_p.h"
#include "jsondb-connection_p.h"
diff --git a/src/clientcompat/jsondb-strings.cpp b/src/clientcompat/jsondb-strings.cpp
new file mode 100644
index 00000000..322b31db
--- /dev/null
+++ b/src/clientcompat/jsondb-strings.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jsondb-strings_p.h"
+
+QT_BEGIN_NAMESPACE_JSONDB
+
+const QString JsonDbString::kUuidStr = QString::fromLatin1("_uuid");
+const QString JsonDbString::kVersionStr = QString::fromLatin1("_version");
+const QString JsonDbString::kIdStr = QString::fromLatin1("id");
+const QString JsonDbString::kResultStr = QString::fromLatin1("result");
+const QString JsonDbString::kErrorStr = QString::fromLatin1("error");
+const QString JsonDbString::kFieldNameStr = QString::fromLatin1("fieldName");
+const QString JsonDbString::kCodeStr = QString::fromLatin1("code");
+const QString JsonDbString::kMessageStr = QString::fromLatin1("message");
+const QString JsonDbString::kNameStr = QString::fromLatin1("name");
+const QString JsonDbString::kCountStr = QString::fromLatin1("count");
+const QString JsonDbString::kCurrentStr = QString::fromLatin1("_current");
+const QString JsonDbString::kDomainStr = QString::fromLatin1("_domain");
+const QString JsonDbString::kOwnerStr = QString::fromLatin1("_owner");
+const QString JsonDbString::kTypeStr = QString::fromLatin1("_type");
+const QString JsonDbString::kTypesStr = QString::fromLatin1("types");
+const QString JsonDbString::kParentStr = QString::fromLatin1("_parent");
+const QString JsonDbString::kSchemaTypeStr = QString::fromLatin1("_schemaType");
+
+const QString JsonDbString::kActionStr = QString::fromLatin1("action");
+const QString JsonDbString::kActionsStr = QString::fromLatin1("actions");
+const QString JsonDbString::kActiveStr = QString::fromLatin1("active");
+const QString JsonDbString::kAddIndexStr = QString::fromLatin1("addIndex");
+const QString JsonDbString::kCreateStr = QString::fromLatin1("create");
+const QString JsonDbString::kDropStr = QString::fromLatin1("drop");
+const QString JsonDbString::kConflictsStr = QString::fromLatin1("conflicts");
+const QString JsonDbString::kConnectStr = QString::fromLatin1("connect");
+const QString JsonDbString::kDataStr = QString::fromLatin1("data");
+const QString JsonDbString::kDeletedStr = QString::fromLatin1("_deleted");
+const QString JsonDbString::kDisconnectStr = QString::fromLatin1("disconnect");
+const QString JsonDbString::kExplanationStr = QString::fromLatin1("explanation");
+const QString JsonDbString::kFindStr = QString::fromLatin1("find");
+const QString JsonDbString::kLengthStr = QString::fromLatin1("length");
+const QString JsonDbString::kLimitStr = QString::fromLatin1("limit");
+const QString JsonDbString::kMapTypeStr = QString::fromLatin1("Map");
+const QString JsonDbString::kMetaStr = QString::fromLatin1("_meta");
+const QString JsonDbString::kNotifyStr = QString::fromLatin1("notify");
+const QString JsonDbString::kNotificationTypeStr = QString::fromLatin1("notification");
+const QString JsonDbString::kObjectStr = QString::fromLatin1("object");
+const QString JsonDbString::kOffsetStr = QString::fromLatin1("offset");
+const QString JsonDbString::kQueryStr = QString::fromLatin1("query");
+const QString JsonDbString::kReduceTypeStr = QString::fromLatin1("Reduce");
+const QString JsonDbString::kRemoveStr = QString::fromLatin1("remove");
+const QString JsonDbString::kSchemaStr = QString::fromLatin1("schema");
+const QString JsonDbString::kUpdateStr = QString::fromLatin1("update");
+const QString JsonDbString::kTokenStr = QString::fromLatin1("token");
+const QString JsonDbString::kFlushStr = QString::fromLatin1("flush");
+const QString JsonDbString::kSettingsStr = QString::fromLatin1("settings");
+const QString JsonDbString::kViewTypeStr = QString::fromLatin1("View");
+const QString JsonDbString::kChangesSinceStr = QString::fromLatin1("changesSince");
+const QString JsonDbString::kStateNumberStr = QString::fromLatin1("stateNumber");
+const QString JsonDbString::kCollapsedStr = QString::fromLatin1("collapsed");
+const QString JsonDbString::kCurrentStateNumberStr = QString::fromLatin1("currentStateNumber");
+const QString JsonDbString::kStartingStateNumberStr = QString::fromLatin1("startingStateNumber");
+const QString JsonDbString::kTombstoneStr = QString::fromLatin1("Tombstone");
+const QString JsonDbString::kPartitionTypeStr = QString::fromLatin1("Partition");
+const QString JsonDbString::kPartitionStr = QString::fromLatin1("partition");
+const QString JsonDbString::kLogStr = QString::fromLatin1("log");
+const QString JsonDbString::kPropertyNameStr = QString::fromLatin1("propertyName");
+const QString JsonDbString::kPropertyTypeStr = QString::fromLatin1("propertyType");
+const QString JsonDbString::kPropertyFunctionStr = QString::fromLatin1("propertyFunction");
+const QString JsonDbString::kObjectTypeStr = QString::fromLatin1("objectType");
+const QString JsonDbString::kDbidTypeStr = QString::fromLatin1("DatabaseId");
+const QString JsonDbString::kIndexTypeStr = QString::fromLatin1("Index");
+const QString JsonDbString::kLocaleStr = QString::fromLatin1("locale");
+const QString JsonDbString::kCollationStr = QString::fromLatin1("collation");
+const QString JsonDbString::kCaseSensitiveStr = QString::fromLatin1("caseSensitive");
+const QString JsonDbString::kCasePreferenceStr = QString::fromLatin1("casePreference");
+const QString JsonDbString::kDatabaseSchemaVersionStr = QString::fromLatin1("databaseSchemaVersion");
+const QString JsonDbString::kPathStr = QString::fromLatin1("path");
+const QString JsonDbString::kDefaultStr = QString::fromLatin1("default");
+
+QT_END_NAMESPACE_JSONDB
diff --git a/src/common/common.pri b/src/common/common.pri
deleted file mode 100644
index a72a792e..00000000
--- a/src/common/common.pri
+++ /dev/null
@@ -1,20 +0,0 @@
-INCLUDEPATH += $$PWD
-
-unix {
- contains(QT_CONFIG,icu) {
- LIBS += -licuuc -licui18n
- } else {
- DEFINES += NO_COLLATION_SUPPORT
- }
-}
-
-HEADERS += \
- $$PWD/jsondb-global.h \
- $$PWD/jsondb-error.h \
- $$PWD/jsondb-strings.h \
- $$PWD/jsondbcollator.h \
- $$PWD/jsondbcollator_p.h
-
-SOURCES += \
- $$PWD/jsondb-strings.cpp \
- $$PWD/jsondbcollator.cpp
diff --git a/src/common/jsondb-error.h b/src/common/jsondb-error.h
deleted file mode 100644
index 3a4989e6..00000000
--- a/src/common/jsondb-error.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../clientcompat/jsondb-error.h"
diff --git a/src/common/jsondb-strings.h b/src/common/jsondb-strings.h
deleted file mode 100644
index dc0295b8..00000000
--- a/src/common/jsondb-strings.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../clientcompat/jsondb-strings_p.h"
diff --git a/src/daemon/daemon.pri b/src/daemon/daemon.pri
deleted file mode 100644
index 18723a1a..00000000
--- a/src/daemon/daemon.pri
+++ /dev/null
@@ -1,55 +0,0 @@
-include($$PWD/../3rdparty/btree/btree.pri)
-include($$PWD/../common/common.pri)
-include($$PWD/../jsonstream/jsonstream.pri)
-
-DEFINES += $$quote(QT_BEGIN_MOC_NAMESPACE=\"QT_USE_NAMESPACE QT_USE_NAMESPACE_JSONDB\")
-
-RESOURCES = $$PWD/jsondb.qrc
-HEADERS += \
- $$PWD/jsondbowner.h \
- $$PWD/jsondbproxy.h \
- $$PWD/jsondbephemeralpartition.h \
- $$PWD/jsondbindex.h \
- $$PWD/jsondbobject.h \
- $$PWD/jsondbpartition.h \
- $$PWD/jsondbquery.h \
- $$PWD/jsondbstat.h \
- $$PWD/jsondbview.h \
- $$PWD/jsondbmapdefinition.h \
- $$PWD/jsondbnotification.h \
- $$PWD/jsondbobjectkey.h \
- $$PWD/jsondbobjecttable.h \
- $$PWD/jsondbmanagedbtree.h \
- $$PWD/jsondbmanagedbtreetxn.h \
- $$PWD/jsondbobjecttypes_impl_p.h \
- $$PWD/jsondbobjecttypes_p.h \
- $$PWD/jsondbreducedefinition.h \
- $$PWD/schema-validation/checkpoints.h \
- $$PWD/schema-validation/object.h \
- $$PWD/jsondbschemamanager_impl_p.h \
- $$PWD/jsondbschemamanager_p.h \
- $$PWD/jsondbscriptengine.h \
- $$PWD/jsondbsignals.h \
- $$PWD/jsondbsettings.h \
- $$PWD/jsondbindexquery.h
-
-SOURCES += \
- $$PWD/jsondbowner.cpp \
- $$PWD/jsondbproxy.cpp \
- $$PWD/jsondbephemeralpartition.cpp \
- $$PWD/jsondbindex.cpp \
- $$PWD/jsondbobject.cpp \
- $$PWD/jsondbpartition.cpp \
- $$PWD/jsondbquery.cpp \
- $$PWD/jsondbview.cpp \
- $$PWD/jsondbmapdefinition.cpp \
- $$PWD/jsondbnotification.cpp \
- $$PWD/jsondbobjecttable.cpp \
- $$PWD/jsondbmanagedbtree.cpp \
- $$PWD/jsondbmanagedbtreetxn.cpp \
- $$PWD/jsondbreducedefinition.cpp \
- $$PWD/jsondbscriptengine.cpp \
- $$PWD/jsondbsignals.cpp \
- $$PWD/jsondbsettings.cpp \
- $$PWD/jsondbindexquery.cpp
-
diff --git a/src/daemon/daemon.pro b/src/daemon/daemon.pro
index 00bcc114..92967870 100644
--- a/src/daemon/daemon.pro
+++ b/src/daemon/daemon.pro
@@ -3,20 +3,24 @@ DESTDIR = $$QT.jsondb.bins
target.path = $$[QT_INSTALL_PREFIX]/bin
INSTALLS += target
+include($$PWD/../jsonstream/jsonstream.pri)
+
LIBS += -L$$QT.jsondb.libs
-QT = core network qml
+QT = core network qml jsondbpartition
mac:CONFIG -= app_bundle
-include(daemon.pri)
-
HEADERS += \
- $$PWD/dbserver.h
+ $$PWD/dbserver.h \
+ $$PWD/jsondbephemeralpartition.h \
+ $$PWD/jsondbsignals.h
SOURCES += \
$$PWD/main.cpp \
- $$PWD/dbserver.cpp
+ $$PWD/dbserver.cpp \
+ $$PWD/jsondbephemeralpartition.cpp \
+ $$PWD/jsondbsignals.cpp
systemd {
DEFINES += USE_SYSTEMD
diff --git a/src/daemon/dbserver.cpp b/src/daemon/dbserver.cpp
index 725daaad..845100a0 100644
--- a/src/daemon/dbserver.cpp
+++ b/src/daemon/dbserver.cpp
@@ -43,8 +43,8 @@
#include <QDir>
#include <QElapsedTimer>
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include "jsondbephemeralpartition.h"
#include "jsondbindexquery.h"
@@ -59,7 +59,7 @@
#include <errno.h>
#endif
-QT_BEGIN_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
static const int gReadBufferSize = 65536;
@@ -1411,5 +1411,3 @@ void DBServer::removeConnection()
}
#include "moc_dbserver.cpp"
-
-QT_END_NAMESPACE_JSONDB
diff --git a/src/daemon/dbserver.h b/src/daemon/dbserver.h
index 34872482..e727369c 100644
--- a/src/daemon/dbserver.h
+++ b/src/daemon/dbserver.h
@@ -58,11 +58,10 @@ class QLocalServer;
class QTcpServer;
QT_END_NAMESPACE
-QT_BEGIN_NAMESPACE_JSONDB
+class JsonDbEphemeralPartition;
using QtJsonDbJsonStream::JsonStream;
-
-class JsonDbEphemeralPartition;
+QT_USE_NAMESPACE_JSONDB_PARTITION
class DBServer : public QObject
{
@@ -154,8 +153,6 @@ private:
bool mCompactOnClose;
};
-QT_END_NAMESPACE_JSONDB
-
QT_END_HEADER
#endif // DBSERVER_H
diff --git a/src/daemon/jsondbephemeralpartition.cpp b/src/daemon/jsondbephemeralpartition.cpp
index c4e4a699..a786394a 100644
--- a/src/daemon/jsondbephemeralpartition.cpp
+++ b/src/daemon/jsondbephemeralpartition.cpp
@@ -43,12 +43,12 @@
#include "jsondbobject.h"
#include "jsondbquery.h"
-#include "jsondb-error.h"
-#include "jsondb-strings.h"
+#include "jsondberrors.h"
+#include "jsondbstrings.h"
#include <qjsonobject.h>
-QT_BEGIN_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
JsonDbEphemeralPartition::JsonDbEphemeralPartition(const QString &name, QObject *parent) :
QObject(parent)
@@ -149,5 +149,3 @@ JsonDbWriteResult JsonDbEphemeralPartition::updateObjects(const JsonDbOwner *own
emit objectsUpdated(updated);
return result;
}
-
-QT_END_NAMESPACE_JSONDB
diff --git a/src/daemon/jsondbephemeralpartition.h b/src/daemon/jsondbephemeralpartition.h
index 8d68477d..e5ed8083 100644
--- a/src/daemon/jsondbephemeralpartition.h
+++ b/src/daemon/jsondbephemeralpartition.h
@@ -53,9 +53,11 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
-
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbQuery;
+QT_END_NAMESPACE_JSONDB_PARTITION
+
+QT_USE_NAMESPACE_JSONDB_PARTITION
class JsonDbEphemeralPartition : public QObject
{
@@ -79,8 +81,6 @@ private:
QString mName;
};
-QT_END_NAMESPACE_JSONDB
-
QT_END_HEADER
#endif // JSONDB_EPHEMERAL_PARTITION_H
diff --git a/src/daemon/jsondbsignals.cpp b/src/daemon/jsondbsignals.cpp
index c27b5f43..15ef8b1b 100644
--- a/src/daemon/jsondbsignals.cpp
+++ b/src/daemon/jsondbsignals.cpp
@@ -119,5 +119,3 @@ void JsonDbSignals::handleSig()
}
mNotifier->setEnabled(true);
}
-
-
diff --git a/src/daemon/jsondbsignals.h b/src/daemon/jsondbsignals.h
index 95b52ce2..2973cd8f 100644
--- a/src/daemon/jsondbsignals.h
+++ b/src/daemon/jsondbsignals.h
@@ -42,7 +42,6 @@
#ifndef JSONDB_SIGNALS_H
#define JSONDB_SIGNALS_H
-#include "jsondb-global.h"
#include <QObject>
QT_BEGIN_HEADER
@@ -51,6 +50,7 @@ QT_BEGIN_NAMESPACE
class QSocketNotifier;
QT_END_NAMESPACE
+
class JsonDbSignals : public QObject
{
Q_OBJECT
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 35200cb0..4370e123 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -50,6 +50,7 @@
#include <stdio.h>
#include <string.h>
+#include "jsondbpartitionglobal.h"
#include "jsondbsettings.h"
#include "jsondbsignals.h"
#include "dbserver.h"
@@ -60,11 +61,7 @@
QString progname;
-QT_BEGIN_NAMESPACE_JSONDB
-
-QT_END_NAMESPACE_JSONDB
-
-QT_USE_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
/***************************************************************************/
diff --git a/src/daemon/jsondb.qrc b/src/partition/jsondb.qrc
index 2a12e110..2a12e110 100644
--- a/src/daemon/jsondb.qrc
+++ b/src/partition/jsondb.qrc
diff --git a/src/common/jsondbcollator.cpp b/src/partition/jsondbcollator.cpp
index 4fa45c4e..869bf3f8 100644
--- a/src/common/jsondbcollator.cpp
+++ b/src/partition/jsondbcollator.cpp
@@ -50,7 +50,7 @@
#include "qdebug.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbCollatorPrivate::~JsonDbCollatorPrivate()
{
@@ -336,6 +336,6 @@ QByteArray JsonDbCollator::sortKey(const QString &string) const
result.truncate(size);
return result;
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
#endif // NO_COLLATION_SUPPORT
diff --git a/src/common/jsondbcollator.h b/src/partition/jsondbcollator.h
index 6214a1a1..d23ea1d1 100644
--- a/src/common/jsondbcollator.h
+++ b/src/partition/jsondbcollator.h
@@ -47,15 +47,15 @@
#include <QString>
#include <QLocale>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbCollatorPrivate;
-class Q_ADDON_JSONDB_EXPORT JsonDbCollator
+class Q_JSONDB_PARTITION_EXPORT JsonDbCollator
{
public:
enum Strength {
@@ -164,7 +164,7 @@ private:
void init();
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/common/jsondbcollator_p.h b/src/partition/jsondbcollator_p.h
index 5a76f29a..1ea44fd7 100644
--- a/src/common/jsondbcollator_p.h
+++ b/src/partition/jsondbcollator_p.h
@@ -52,7 +52,7 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbCollatorPrivate
{
@@ -78,7 +78,7 @@ public:
int compare(ushort *s1, int len1, ushort *s2, int len2);
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/partition/jsondberrors.cpp b/src/partition/jsondberrors.cpp
new file mode 100644
index 00000000..3a66ab49
--- /dev/null
+++ b/src/partition/jsondberrors.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jsondbpartitionglobal.h"
+#include "jsondberrors.h"
+
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
+
+/*!
+ \class JsonDbError
+ \brief The JsonDbError class lists possible error codes.
+ \sa JsonDbError::ErrorCode
+ */
+
+/*!
+ \enum JsonDbError::ErrorCode
+ \omitvalue NoError
+ \value InvalidMessage
+ Unable to parse the query message.
+ \value InvalidRequest
+ Request object doesn't contain correct elements.
+ \value MissingObject
+ Invalid or missing "object" field.
+ \value DatabaseError
+ Error directly from the database.
+ \value MissingUUID
+ Missing id field.
+ \value MissingType
+ Missing _type field.
+ \value MissingQuery
+ Missing query field.
+ \value InvalidLimit
+ Invalid limit field.
+ \value InvalidOffset
+ Invalid offset field.
+ \value MismatchedNotifyId
+ Request to delete notify doesn't match existing notification.
+ \value InvalidActions
+ List of actions supplied to setNotification is invalid.
+ \value UpdatingStaleVersion
+ Updating stale version of object.
+ \value OperationNotPermitted
+ Operation prohibited by access control policy.
+ \value QuotaExceeded
+ Operation would exceed quota.
+ \value FailedSchemaValidation
+ Object to be created/updated was invalid according to the schema.
+ \value InvalidMap
+ The Map definition is invalid.
+ \value InvalidReduce
+ The Reduce definition is invalid.
+ \value InvalidSchemaOperation
+ Attempted to create a schema that already exists or to remove a schema when there are still objects belonging to the schema's type.
+ \value InvalidPartition
+ Invalid partition.
+ \value InvalidIndexOperation
+ An error when creating an index object
+ */
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/common/jsondb-global.h b/src/partition/jsondberrors.h
index 1ad585a8..482d25e3 100644
--- a/src/common/jsondb-global.h
+++ b/src/partition/jsondberrors.h
@@ -39,4 +39,50 @@
**
****************************************************************************/
-#include "../clientcompat/jsondb-global.h"
+#ifndef JSONDB_ERRORS_H
+#define JSONDB_ERRORS_H
+
+#include "jsondbpartitionglobal.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
+
+class Q_JSONDB_PARTITION_EXPORT JsonDbError {
+public:
+ enum ErrorCode {
+ // common errors
+ NoError = 0,
+ InvalidRequest = 1,
+ OperationNotPermitted = 2,
+ InvalidPartition = 3,
+ DatabaseConnectionError = 4,
+
+ // read / notify errors
+ MissingQuery = 5,
+ InvalidMessage= 6,
+ InvalidLimit = 7,
+ InvalidOffset = 8,
+ InvalidStateNumber = 9,
+
+ // write errors
+ MissingObject = 10,
+ DatabaseError = 11,
+ MissingUUID = 12,
+ MissingType = 13,
+ UpdatingStaleVersion = 14,
+ QuotaExceeded = 15,
+ FailedSchemaValidation = 16,
+ InvalidMap = 17,
+ InvalidReduce = 18,
+ InvalidSchemaOperation = 19,
+ InvalidIndexOperation = 20,
+ InvalidType = 21
+ };
+};
+
+QT_END_NAMESPACE_JSONDB_PARTITION
+
+QT_END_HEADER
+
+#endif // JSONDB_ERRORS_H
diff --git a/src/daemon/jsondbindex.cpp b/src/partition/jsondbindex.cpp
index 8f2430bc..76624e88 100644
--- a/src/daemon/jsondbindex.cpp
+++ b/src/partition/jsondbindex.cpp
@@ -47,15 +47,18 @@
#include <QDir>
#include <QLocale>
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbproxy.h"
#include "jsondbindex.h"
#include "jsondbmanagedbtree.h"
#include "jsondbsettings.h"
#include "jsondbobjecttable.h"
#include "jsondbscriptengine.h"
+#include "qbtree.h"
+#include "qbtreecursor.h"
+#include "qbtreetxn.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
static const int collationStringsCount = 13;
static const char * const collationStrings[collationStringsCount] = {
@@ -132,6 +135,30 @@ QString _q_bytesToHexString(const QByteArray &ba)
return result;
}
+class JsonDbIndexCursor
+{
+public:
+ JsonDbIndexCursor(JsonDbIndex *index);
+ ~JsonDbIndexCursor();
+
+ bool seek(const QJsonValue &value);
+ bool seekRange(const QJsonValue &value);
+
+ bool first();
+ bool current(QJsonValue &key, ObjectKey &value);
+ bool currentKey(QJsonValue &key);
+ bool currentValue(ObjectKey &value);
+ bool next();
+ bool prev();
+
+private:
+ QBtreeTxn *mTxn;
+ QBtreeCursor mCursor;
+ JsonDbIndex *mIndex;
+
+ JsonDbIndexCursor(const JsonDbIndexCursor&);
+};
+
JsonDbIndex::JsonDbIndex(const QString &fileName, const QString &indexName, const QString &propertyName,
const QString &propertyType, const QStringList &objectType, const QString &locale, const QString &collation,
const QString &casePreference, Qt::CaseSensitivity caseSensitivity, JsonDbObjectTable *objectTable)
@@ -206,12 +233,12 @@ bool JsonDbIndex::open()
if (mCacheSize)
mBdb->setCacheSize(mCacheSize);
- if (!mBdb->open(mFileName, QBtree::NoSync | QBtree::UseSyncMarker)) {
+ if (!mBdb->open(mFileName)) {
qCritical() << "mBdb->open" << mBdb->errorMessage();
return false;
}
- mBdb->setCmpFunc(forwardKeyCmp);
+ mBdb->btree()->setCmpFunc(forwardKeyCmp);
mStateNumber = mBdb->tag();
if (jsondbSettings->debug() && jsondbSettings->verbose())
@@ -570,4 +597,6 @@ bool JsonDbIndexCursor::prev()
return mCursor.prev();
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbindex.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbindex.h b/src/partition/jsondbindex.h
index 3520c2e8..d4b11ad6 100644
--- a/src/daemon/jsondbindex.h
+++ b/src/partition/jsondbindex.h
@@ -53,22 +53,20 @@
#include "jsondbobject.h"
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include "jsondbobjectkey.h"
#include "jsondbmanagedbtreetxn.h"
-#include "qbtreecursor.h"
-#include "qbtreetxn.h"
#include "jsondbcollator.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbManagedBtree;
class JsonDbPartition;
class JsonDbObjectTable;
-class JsonDbIndex : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbIndex : public QObject
{
Q_OBJECT
public:
@@ -136,30 +134,6 @@ private:
quint32 mCacheSize;
};
-class JsonDbIndexCursor
-{
-public:
- JsonDbIndexCursor(JsonDbIndex *index);
- ~JsonDbIndexCursor();
-
- bool seek(const QJsonValue &value);
- bool seekRange(const QJsonValue &value);
-
- bool first();
- bool current(QJsonValue &key, ObjectKey &value);
- bool currentKey(QJsonValue &key);
- bool currentValue(ObjectKey &value);
- bool next();
- bool prev();
-
-private:
- QBtreeTxn *mTxn;
- QBtreeCursor mCursor;
- JsonDbIndex *mIndex;
-
- JsonDbIndexCursor(const JsonDbIndexCursor&);
-};
-
class IndexSpec {
public:
QString name;
@@ -175,7 +149,7 @@ public:
QPointer<JsonDbIndex> index;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbindexquery.cpp b/src/partition/jsondbindexquery.cpp
index 6461a67b..06f52826 100644
--- a/src/daemon/jsondbindexquery.cpp
+++ b/src/partition/jsondbindexquery.cpp
@@ -45,12 +45,13 @@
#include "jsondbobjecttable.h"
#include "jsondbpartition.h"
#include "jsondbsettings.h"
-
+#include "qbtree.h"
+#include "qbtreecursor.h"
#include "qbtreetxn.h"
#include <QJsonDocument>
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbIndexQuery *JsonDbIndexQuery::indexQuery(JsonDbPartition *partition, JsonDbObjectTable *table,
const QString &propertyName, const QString &propertyType,
@@ -449,4 +450,4 @@ bool JsonDbIndexQuery::greaterThan(const QJsonValue &a, const QJsonValue &b)
}
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbindexquery.h b/src/partition/jsondbindexquery.h
index ff330392..62c84d4d 100644
--- a/src/daemon/jsondbindexquery.h
+++ b/src/partition/jsondbindexquery.h
@@ -48,6 +48,7 @@
#include <QVector>
#include <QStringList>
+#include "jsondbpartitionglobal.h"
#include "jsondbobject.h"
#include "jsondbobjectkey.h"
@@ -56,7 +57,7 @@ QT_BEGIN_HEADER
class QBtreeCursor;
class QBtreeTxn;
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbManagedBtree;
class JsonDbObjectTable;
@@ -71,7 +72,7 @@ public:
virtual bool sparseMatchPossible() const { return false; }
};
-class JsonDbIndexQuery {
+class Q_JSONDB_PARTITION_EXPORT JsonDbIndexQuery {
protected:
JsonDbIndexQuery(JsonDbPartition *partition, JsonDbObjectTable *table,
const QString &propertyName, const QString &propertyType,
@@ -243,7 +244,7 @@ private:
QRegExp mRegExp;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbmanagedbtree.cpp b/src/partition/jsondbmanagedbtree.cpp
index 3e8b93c0..80c176bc 100644
--- a/src/daemon/jsondbmanagedbtree.cpp
+++ b/src/partition/jsondbmanagedbtree.cpp
@@ -48,9 +48,9 @@
#include "jsondbmanagedbtree.h"
#include "jsondbmanagedbtreetxn.h"
#include "jsondbsettings.h"
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbManagedBtree::JsonDbManagedBtree()
: mBtree(new QBtree())
@@ -65,10 +65,10 @@ JsonDbManagedBtree::~JsonDbManagedBtree()
delete mBtree;
}
-bool JsonDbManagedBtree::open(const QString &filename, QBtree::DbFlags flags)
+bool JsonDbManagedBtree::open(const QString &filename)
{
mBtree->setFileName(filename);
- mBtree->setFlags(flags);
+ mBtree->setFlags(QBtree::NoSync | QBtree::UseSyncMarker);
return mBtree->open();
}
@@ -295,12 +295,57 @@ bool JsonDbManagedBtree::clearData()
return mBtree->open();
}
-QBtree::Stat JsonDbManagedBtree::stat() const
+QString JsonDbManagedBtree::fileName() const
{
- if (mBtree)
- return mBtree->stat();
- else
- return QBtree::Stat();
+ Q_ASSERT(mBtree);
+ return mBtree->fileName();
+}
+
+quint64 JsonDbManagedBtree::count() const
+{
+ Q_ASSERT(mBtree);
+ return mBtree->count();
+}
+
+quint32 JsonDbManagedBtree::tag() const
+{
+ Q_ASSERT(mBtree);
+ return mBtree->tag();
+}
+
+bool JsonDbManagedBtree::compact()
+{
+ Q_ASSERT(mBtree);
+ return mBtree->compact();
+}
+
+bool JsonDbManagedBtree::rollback()
+{
+ Q_ASSERT(mBtree && !numActiveReadTxns() && !isWriteTxnActive());
+ return mBtree->rollback();
+}
+
+struct btree *JsonDbManagedBtree::handle() const
+{
+ Q_ASSERT(mBtree);
+ return mBtree->handle();
+}
+
+void JsonDbManagedBtree::setAutoCompactRate(int rate) const
+{
+ Q_ASSERT(mBtree);
+ mBtree->setAutoCompactRate(rate);
+}
+
+void JsonDbManagedBtree::setCacheSize(int size)
+{
+ Q_ASSERT(mBtree);
+ mBtree->setCacheSize(size);
+}
+
+QBtree *JsonDbManagedBtree::btree() const
+{
+ return mBtree;
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbmanagedbtree.h b/src/partition/jsondbmanagedbtree.h
index be737cfd..7ea3050a 100644
--- a/src/daemon/jsondbmanagedbtree.h
+++ b/src/partition/jsondbmanagedbtree.h
@@ -44,22 +44,23 @@
#include <QMap>
#include <QSet>
-#include "qbtree.h"
#include "jsondbmanagedbtreetxn.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
class QBtree;
+class QBtreeTxn;
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
-class JsonDbManagedBtree
+class Q_JSONDB_PARTITION_EXPORT JsonDbManagedBtree
{
public:
JsonDbManagedBtree();
~JsonDbManagedBtree();
- bool open(const QString &filename, QBtree::DbFlags flags = QBtree::Default);
+ bool open(const QString &filename);
void close();
JsonDbManagedBtreeTxn beginRead(quint32 tag);
@@ -83,27 +84,15 @@ public:
QString errorMessage() const;
- QString fileName() const
- { Q_ASSERT(mBtree); return mBtree->fileName(); }
- quint64 count() const
- { Q_ASSERT(mBtree); return mBtree->count(); }
- quint32 tag() const
- { Q_ASSERT(mBtree); return mBtree->tag(); }
- bool compact()
- { Q_ASSERT(mBtree); return mBtree->compact(); }
- bool rollback()
- { Q_ASSERT(mBtree && !numActiveReadTxns() && !isWriteTxnActive()); return mBtree->rollback(); }
- struct btree *handle() const
- { Q_ASSERT(mBtree); return mBtree->handle(); }
- void setAutoCompactRate(int rate) const
- { Q_ASSERT(mBtree); mBtree->setAutoCompactRate(rate); }
- void setCmpFunc(QBtree::CmpFunc cmp)
- { Q_ASSERT(mBtree); mBtree->setCmpFunc(cmp); }
- void setCacheSize(int size)
- { Q_ASSERT(mBtree); mBtree->setCacheSize(size); }
- QBtree *btree() const
- { return mBtree; }
- QBtree::Stat stat() const;
+ QString fileName() const;
+ quint64 count() const;
+ quint32 tag() const;
+ bool compact();
+ bool rollback();
+ struct btree *handle() const;
+ void setAutoCompactRate(int rate) const;
+ void setCacheSize(int size);
+ QBtree *btree() const;
private:
friend class JsonDbManagedBtreeTxn;
@@ -126,7 +115,7 @@ private:
JsonDbManagedBtree(const JsonDbManagedBtree&);
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbmanagedbtreetxn.cpp b/src/partition/jsondbmanagedbtreetxn.cpp
index 07860f1b..7f9f54f4 100644
--- a/src/daemon/jsondbmanagedbtreetxn.cpp
+++ b/src/partition/jsondbmanagedbtreetxn.cpp
@@ -40,11 +40,12 @@
****************************************************************************/
#include <QDebug>
+#include "qbtree.h"
#include "qbtreetxn.h"
#include "jsondbmanagedbtree.h"
#include "jsondbmanagedbtreetxn.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbManagedBtreeTxn::JsonDbManagedBtreeTxn()
: mTxn(0), mBtree(0), mTag(0), mIsRead(false)
@@ -134,4 +135,4 @@ void JsonDbManagedBtreeTxn::reset(JsonDbManagedBtree *mbtree, QBtreeTxn *txn)
}
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbmanagedbtreetxn.h b/src/partition/jsondbmanagedbtreetxn.h
index f692bc30..4dceb2cd 100644
--- a/src/daemon/jsondbmanagedbtreetxn.h
+++ b/src/partition/jsondbmanagedbtreetxn.h
@@ -42,18 +42,18 @@
#ifndef JSONDB_MANAGED_BTREE_TXN_H
#define JSONDB_MANAGED_BTREE_TXN_H
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
class QBtree;
class QBtreeTxn;
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbManagedBtree;
-class JsonDbManagedBtreeTxn
+class Q_JSONDB_PARTITION_EXPORT JsonDbManagedBtreeTxn
{
public:
JsonDbManagedBtreeTxn();
@@ -100,7 +100,7 @@ public:
}
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbmapdefinition.cpp b/src/partition/jsondbmapdefinition.cpp
index 0a53c136..07c4a1df 100644
--- a/src/daemon/jsondbmapdefinition.cpp
+++ b/src/partition/jsondbmapdefinition.cpp
@@ -51,8 +51,8 @@
#include <stdlib.h>
#include "jsondbpartition.h"
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include "jsondbproxy.h"
#include "jsondbobjecttable.h"
@@ -61,7 +61,7 @@
#include "jsondbscriptengine.h"
#include "jsondbview.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbMapDefinition::JsonDbMapDefinition(const JsonDbOwner *owner, JsonDbPartition *partition, QJsonObject definition, QObject *parent) :
QObject(parent)
@@ -469,4 +469,6 @@ bool JsonDbMapDefinition::validateDefinition(const JsonDbObject &map, JsonDbPart
return message.isEmpty();
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbmapdefinition.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbmapdefinition.h b/src/partition/jsondbmapdefinition.h
index 30140fcd..a25f7d7d 100644
--- a/src/daemon/jsondbmapdefinition.h
+++ b/src/partition/jsondbmapdefinition.h
@@ -45,8 +45,8 @@
#include <QJSEngine>
#include <QStringList>
-#include "jsondb-global.h"
#include "jsondbpartition.h"
+#include "jsondbpartitionglobal.h"
#include <qjsonarray.h>
#include <qjsonobject.h>
@@ -56,7 +56,7 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbOwner;
class JsonDbJoinProxy;
@@ -117,7 +117,7 @@ private:
QHash<QString,JsonDbObject> mEmittedObjects;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbnotification.cpp b/src/partition/jsondbnotification.cpp
index 083f4465..d8687309 100644
--- a/src/daemon/jsondbnotification.cpp
+++ b/src/partition/jsondbnotification.cpp
@@ -48,9 +48,9 @@
#include "jsondbnotification.h"
#include "jsondbquery.h"
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbNotification::JsonDbNotification(const JsonDbOwner *owner, const QString &uuid, const QString& query,
QStringList actions, const QString &partition)
@@ -80,4 +80,4 @@ JsonDbNotification::~JsonDbNotification()
}
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbnotification.h b/src/partition/jsondbnotification.h
index d99383c8..9e52d4bb 100644
--- a/src/daemon/jsondbnotification.h
+++ b/src/partition/jsondbnotification.h
@@ -45,15 +45,15 @@
#include <QObject>
#include <QJSValue>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbOwner;
class JsonDbQuery;
-class JsonDbNotification {
+class Q_JSONDB_PARTITION_EXPORT JsonDbNotification {
public:
enum Action { None = 0x0000, Create = 0x0001, Update = 0x0002, Delete = 0x0004 };
Q_DECLARE_FLAGS(Actions, Action)
@@ -85,7 +85,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(JsonDbNotification::Actions)
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbobject.cpp b/src/partition/jsondbobject.cpp
index e448a7fb..e61d6ebf 100644
--- a/src/daemon/jsondbobject.cpp
+++ b/src/partition/jsondbobject.cpp
@@ -49,10 +49,10 @@
#include <qjsondocument.h>
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbproxy.h"
-QT_ADDON_JSONDB_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbObject::JsonDbObject()
{
@@ -607,4 +607,4 @@ QJsonValue JsonDbObject::propertyLookup(const QStringList &path) const
return value;
}
-QT_ADDON_JSONDB_END_NAMESPACE
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbobject.h b/src/partition/jsondbobject.h
index 8a0eef05..f5860a47 100644
--- a/src/daemon/jsondbobject.h
+++ b/src/partition/jsondbobject.h
@@ -51,13 +51,13 @@
#include <qjsonobject.h>
#include <qjsonvalue.h>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_ADDON_JSONDB_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
-class JsonDbObject : public QJsonObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbObject : public QJsonObject
{
public:
JsonDbObject();
@@ -107,7 +107,8 @@ struct GetObjectsResult
};
-QT_ADDON_JSONDB_END_NAMESPACE
+QT_END_NAMESPACE_JSONDB_PARTITION
+
QT_END_HEADER
#endif // JSONDB_OBJECT_H
diff --git a/src/daemon/jsondbobjectkey.h b/src/partition/jsondbobjectkey.h
index 9ce9ad4a..ca51295d 100644
--- a/src/daemon/jsondbobjectkey.h
+++ b/src/partition/jsondbobjectkey.h
@@ -47,13 +47,13 @@
#include <qdebug.h>
#include <quuid.h>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
-class ObjectKey
+class Q_JSONDB_PARTITION_EXPORT ObjectKey
{
public:
QUuid key; // object uuid
@@ -80,19 +80,19 @@ inline QDebug &operator<<(QDebug &qdb, const ObjectKey &objectKey)
return qdb;
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_BEGIN_NAMESPACE
-template <> inline void qToBigEndian(QT_PREPEND_NAMESPACE_JSONDB(ObjectKey) src, uchar *dest)
+template <> inline void qToBigEndian(QT_PREPEND_NAMESPACE_JSONDB_PARTITION(ObjectKey) src, uchar *dest)
{
//TODO: improve me
QByteArray key = src.key.toRfc4122();
memcpy(dest, key.constData(), key.size());
}
-template <> inline QT_PREPEND_NAMESPACE_JSONDB(ObjectKey) qFromBigEndian(const uchar *src)
+template <> inline QT_PREPEND_NAMESPACE_JSONDB_PARTITION(ObjectKey) qFromBigEndian(const uchar *src)
{
- QT_PREPEND_NAMESPACE_JSONDB(ObjectKey) key;
+ QT_PREPEND_NAMESPACE_JSONDB_PARTITION(ObjectKey) key;
key.key = QUuid::fromRfc4122(QByteArray::fromRawData((const char *)src, 16));
return key;
}
diff --git a/src/daemon/jsondbobjecttable.cpp b/src/partition/jsondbobjecttable.cpp
index fa27b8bc..292bc88a 100644
--- a/src/daemon/jsondbobjecttable.cpp
+++ b/src/partition/jsondbobjecttable.cpp
@@ -46,13 +46,15 @@
#include "jsondbobjecttable.h"
#include "jsondbindex.h"
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbmanagedbtree.h"
#include "jsondbobject.h"
#include "jsondbsettings.h"
+#include "qbtree.h"
+#include "qbtreecursor.h"
#include "qbtreetxn.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
void makeStateKey(QByteArray &baStateKey, quint32 stateNumber)
{
@@ -82,7 +84,7 @@ JsonDbObjectTable::~JsonDbObjectTable()
mBdb = 0;
}
-bool JsonDbObjectTable::open(const QString&fileName, QBtree::DbFlags flags)
+bool JsonDbObjectTable::open(const QString&fileName)
{
mFilename = fileName;
#if 0
@@ -92,7 +94,7 @@ bool JsonDbObjectTable::open(const QString&fileName, QBtree::DbFlags flags)
}
#endif
mBdb->setCacheSize(jsondbSettings->cacheSize());
- if (!mBdb->open(mFilename, flags)) {
+ if (!mBdb->open(mFilename)) {
qCritical() << "mBdb->open" << mBdb->errorMessage();
return false;
}
@@ -210,12 +212,14 @@ JsonDbStat JsonDbObjectTable::stat() const
++it) {
const IndexSpec &indexSpec = it.value();
if (indexSpec.index->bdb()) {
- QBtree::Stat stat = indexSpec.index->bdb()->stat();
+ QBtree::Stat stat = indexSpec.index->bdb()->btree() ?
+ indexSpec.index->bdb()->btree()->stat() :
+ QBtree::Stat();
result += JsonDbStat(stat.reads, stat.hits, stat.writes);
}
// _uuid index does not have bdb() because it is actually the object table itself
}
- QBtree::Stat stat = mBdb->stat();
+ QBtree::Stat stat = mBdb->btree() ? mBdb->btree()->stat() : QBtree::Stat();
result += JsonDbStat(stat.reads, stat.hits, stat.writes);
return result;
}
@@ -703,4 +707,6 @@ quint32 JsonDbObjectTable::changesSince(quint32 stateNumber, const QSet<QString>
return mStateNumber;
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbobjecttable.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbobjecttable.h b/src/partition/jsondbobjecttable.h
index d1d87e44..b36500d0 100644
--- a/src/daemon/jsondbobjecttable.h
+++ b/src/partition/jsondbobjecttable.h
@@ -50,7 +50,6 @@
#include "jsondbobjectkey.h"
#include "jsondbmanagedbtreetxn.h"
-#include "qbtree.h"
#include <qjsonarray.h>
#include <qjsonobject.h>
@@ -62,7 +61,7 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbManagedBtree;
@@ -84,7 +83,7 @@ inline QDebug &operator<<(QDebug &qdb, const JsonDbUpdate &oc)
}
-class JsonDbObjectTable : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbObjectTable : public QObject
{
Q_OBJECT
public:
@@ -98,7 +97,7 @@ public:
~JsonDbObjectTable();
QString filename() const { return mFilename; }
- bool open(const QString &filename, QBtree::DbFlags flags);
+ bool open(const QString &filename);
void close();
JsonDbPartition *partition() const { return mPartition; }
JsonDbManagedBtree *bdb() const { return mBdb; }
@@ -173,7 +172,7 @@ bool isStateKey(const QByteArray &baStateKey);
Q_DECLARE_OPERATORS_FOR_FLAGS(JsonDbObjectTable::SyncFlags)
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbobjecttypes_impl_p.h b/src/partition/jsondbobjecttypes_impl_p.h
index ac0bb40a..f2833c9b 100644
--- a/src/daemon/jsondbobjecttypes_impl_p.h
+++ b/src/partition/jsondbobjecttypes_impl_p.h
@@ -42,11 +42,11 @@
#ifndef JSONDB_OBJECTTYPES_IMPL_P_H
#define JSONDB_OBJECTTYPES_IMPL_P_H
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include "jsondbobjecttypes_p.h"
#include "jsondbschemamanager_p.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
inline QJsonObjectTypes::ValueList::ValueList(const QJsonArray &list) : QJsonArray(list)
{}
@@ -347,6 +347,6 @@ inline SchemaValidation::Schema<QJsonObjectTypes> QJsonObjectTypes::Service::loa
return m_schemas->schema(schemaName, this);
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
#endif // JSONDB_OBJECTTYPES_IMPL_P_H
diff --git a/src/daemon/jsondbobjecttypes_p.h b/src/partition/jsondbobjecttypes_p.h
index d161286f..f2b42f58 100644
--- a/src/daemon/jsondbobjecttypes_p.h
+++ b/src/partition/jsondbobjecttypes_p.h
@@ -42,8 +42,8 @@
#ifndef JSONDB_OBJECTTYPES_P_H
#define JSONDB_OBJECTTYPES_P_H
-#include "jsondb-global.h"
-#include "jsondb-strings.h"
+#include "jsondbpartitionglobal.h"
+#include "jsondbstrings.h"
#include "schema-validation/object.h"
@@ -53,7 +53,7 @@
#include <qjsonobject.h>
#include <qjsonvalue.h>
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbSchemaManager;
@@ -175,6 +175,6 @@ public:
};
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
#endif // JSONDB_OBJECTTYPES_P_H
diff --git a/src/daemon/jsondbowner.cpp b/src/partition/jsondbowner.cpp
index ed80f500..0d07fe3a 100644
--- a/src/daemon/jsondbowner.cpp
+++ b/src/partition/jsondbowner.cpp
@@ -42,7 +42,7 @@
#include "jsondbowner.h"
#include "jsondbpartition.h"
#include "jsondbsettings.h"
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include <qdebug.h>
#ifdef Q_OS_UNIX
@@ -51,7 +51,7 @@
#include <errno.h>
#endif
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbOwner::JsonDbOwner( QObject *parent )
: QObject(parent), mStorageQuota(-1), mAllowAll(false)
@@ -287,4 +287,6 @@ bool JsonDbOwner::setOwnerCapabilities(uid_t uid, JsonDbPartition *partition)
#endif
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbowner.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbowner.h b/src/partition/jsondbowner.h
index de97a7b4..825cf80f 100644
--- a/src/daemon/jsondbowner.h
+++ b/src/partition/jsondbowner.h
@@ -47,19 +47,18 @@
#include <QString>
#include <QSet>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include "jsondbquery.h"
#include "jsondbobject.h"
-
QT_BEGIN_HEADER
class TestJsonDb;
struct passwd;
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
-class JsonDbOwner : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbOwner : public QObject
{
Q_OBJECT
public:
@@ -95,7 +94,7 @@ private:
bool _setOwnerCapabilities(struct passwd *pwd, JsonDbPartition *partition);
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbpartition.cpp b/src/partition/jsondbpartition.cpp
index 3f8e76e3..68c530f4 100644
--- a/src/daemon/jsondbpartition.cpp
+++ b/src/partition/jsondbpartition.cpp
@@ -59,8 +59,8 @@
#include <unistd.h>
#include <stdlib.h>
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include "jsondbpartition.h"
#include "jsondbindex.h"
#include "jsondbindexquery.h"
@@ -71,7 +71,7 @@
#include "jsondbschemamanager_impl_p.h"
#include "jsondbobjecttypes_impl_p.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
const QString gDatabaseSchemaVersion = "0.2";
@@ -126,7 +126,7 @@ bool JsonDbPartition::open()
qDebug() << "JsonDbBtree::open" << mPartitionName << mFilename;
mObjectTable = new JsonDbObjectTable(this);
- mObjectTable->open(mFilename, QBtree::NoSync | QBtree::UseSyncMarker);
+ mObjectTable->open(mFilename);
if (!checkStateConsistency()) {
qCritical() << "JsonDbBtreePartition::open()" << "Unable to recover database";
@@ -1903,4 +1903,6 @@ void JsonDbPartition::initSchemas()
}
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbpartition.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbpartition.h b/src/partition/jsondbpartition.h
index a107069a..ebd5ab03 100644
--- a/src/daemon/jsondbpartition.h
+++ b/src/partition/jsondbpartition.h
@@ -49,20 +49,21 @@
#include <QVector>
#include <QPointer>
+#include "jsondberrors.h"
#include "jsondbmanagedbtreetxn.h"
#include "jsondbobjectkey.h"
#include "jsondbnotification.h"
#include "jsondbowner.h"
+#include "jsondbpartitionglobal.h"
#include "jsondbstat.h"
#include "jsondbindex.h"
#include "jsondbschemamanager_p.h"
-#include "qbtree.h"
QT_BEGIN_HEADER
class TestJsonDb;
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbManagedBtree;
class JsonDbOwner;
@@ -89,7 +90,7 @@ struct JsonDbWriteResult {
QString message;
};
-class JsonDbPartition : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbPartition : public QObject
{
Q_OBJECT
public:
@@ -271,8 +272,8 @@ private:
};
QJsonValue makeFieldValue(const QJsonValue &value, const QString &type);
-QByteArray makeForwardKey(const QJsonValue &fieldValue, const ObjectKey &objectKey);
-int forwardKeyCmp(const char *aptr, size_t asiz, const char *bptr, size_t bsiz, void *op);
+Q_JSONDB_PARTITION_EXPORT QByteArray makeForwardKey(const QJsonValue &fieldValue, const ObjectKey &objectKey);
+Q_JSONDB_PARTITION_EXPORT int forwardKeyCmp(const char *aptr, size_t asiz, const char *bptr, size_t bsiz, void *op);
void forwardKeySplit(const QByteArray &forwardKey, QJsonValue &fieldValue);
void forwardKeySplit(const QByteArray &forwardKey, QJsonValue &fieldValue, ObjectKey &objectKey);
QByteArray makeForwardValue(const ObjectKey &);
@@ -280,7 +281,7 @@ void forwardValueSplit(const QByteArray &forwardValue, ObjectKey &objectKey);
QDebug &operator<<(QDebug &, const ObjectKey &);
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/partition/jsondbpartitionglobal.h b/src/partition/jsondbpartitionglobal.h
new file mode 100644
index 00000000..9b88409b
--- /dev/null
+++ b/src/partition/jsondbpartitionglobal.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JSONDB_PARTITION_GLOBAL_H
+#define JSONDB_PARTITION_GLOBAL_H
+
+#include "QtCore/qglobal.h"
+
+#if defined(QT_JSONDB_PARTITION_LIB)
+# define Q_JSONDB_PARTITION_EXPORT Q_DECL_EXPORT
+#else
+# define Q_JSONDB_PARTITION_EXPORT Q_DECL_IMPORT
+#endif
+
+#if defined(QT_NAMESPACE)
+# define QT_BEGIN_NAMESPACE_JSONDB_PARTITION namespace QT_NAMESPACE { namespace QtJsonDb { namespace Partition {
+# define QT_END_NAMESPACE_JSONDB_PARTITION } } }
+# define QT_USE_NAMESPACE_JSONDB_PARTITION using namespace QT_NAMESPACE::QtJsonDb::Partition;
+# define QT_PREPEND_NAMESPACE_JSONDB_PARTITION(name) ::QT_NAMESPACE::QtJsonDb::Partition::name
+#else
+# define QT_BEGIN_NAMESPACE_JSONDB_PARTITION namespace QtJsonDb { namespace Partition {
+# define QT_END_NAMESPACE_JSONDB_PARTITION } }
+# define QT_USE_NAMESPACE_JSONDB_PARTITION using namespace QtJsonDb::Partition;
+# define QT_PREPEND_NAMESPACE_JSONDB_PARTITION(name) ::QtJsonDb::Partition::name
+#endif
+
+// a workaround for moc - if there is a header file that doesn't use jsondb
+// namespace, we still force moc to do "using namespace" but the namespace have to
+// be defined, so let's define an empty namespace here
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
+QT_END_NAMESPACE_JSONDB_PARTITION
+
+#endif // JSONDB_PARTITION_GLOBAL_H
diff --git a/src/daemon/jsondbproxy.cpp b/src/partition/jsondbproxy.cpp
index f5947403..d6040717 100644
--- a/src/daemon/jsondbproxy.cpp
+++ b/src/partition/jsondbproxy.cpp
@@ -40,14 +40,14 @@
****************************************************************************/
#include "jsondbproxy.h"
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbobject.h"
#include "jsondbsettings.h"
#include <QDebug>
#include <QJSEngine>
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbMapProxy::JsonDbMapProxy(const JsonDbOwner *owner, JsonDbPartition *partition, QObject *parent)
: QObject(parent)
@@ -140,4 +140,6 @@ void Console::error(const QString &s)
qCritical() << s;
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbproxy.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbproxy.h b/src/partition/jsondbproxy.h
index c1962785..886a6ba1 100644
--- a/src/daemon/jsondbproxy.h
+++ b/src/partition/jsondbproxy.h
@@ -46,16 +46,16 @@
#include <QMultiMap>
#include <QJSValue>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbOwner;
class JsonDbPartition;
-class JsonDbMapProxy : public QObject {
+class Q_JSONDB_PARTITION_EXPORT JsonDbMapProxy : public QObject {
Q_OBJECT
public:
JsonDbMapProxy(const JsonDbOwner *owner, JsonDbPartition *partition, QObject *parent=0);
@@ -76,7 +76,7 @@ private:
JsonDbPartition *mPartition;
};
-class JsonDbJoinProxy : public QObject {
+class Q_JSONDB_PARTITION_EXPORT JsonDbJoinProxy : public QObject {
Q_OBJECT
public:
JsonDbJoinProxy( const JsonDbOwner *owner, JsonDbPartition *partition, QObject *parent=0 );
@@ -107,7 +107,7 @@ public:
Q_SCRIPTABLE void error(const QString &string);
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbquery.cpp b/src/partition/jsondbquery.cpp
index 8a4e67da..393ec1f4 100644
--- a/src/daemon/jsondbquery.cpp
+++ b/src/partition/jsondbquery.cpp
@@ -45,13 +45,13 @@
#include <QStack>
#include <QString>
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbindexquery.h"
#include "jsondbpartition.h"
#include "jsondbquery.h"
#include "jsondbsettings.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
const char* JsonDbQueryTokenizer::sTokens[] = {
"[", "]", "{", "}", "/", "?", ",", ":", "|", "\\"
@@ -685,4 +685,4 @@ JsonDbQueryResult JsonDbQueryResult::makeErrorResponse(JsonDbError::ErrorCode co
return result;
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbquery.h b/src/partition/jsondbquery.h
index b618eec5..324f9ee1 100644
--- a/src/daemon/jsondbquery.h
+++ b/src/partition/jsondbquery.h
@@ -47,7 +47,7 @@
#include <QHash>
#include <QStringList>
#include <QVariant>
-#include "jsondb-error.h"
+#include "jsondberrors.h"
#include <qjsonarray.h>
#include <qjsonobject.h>
@@ -57,11 +57,11 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbPartition;
-class JsonDbQueryTokenizer {
+class Q_JSONDB_PARTITION_EXPORT JsonDbQueryTokenizer {
public:
JsonDbQueryTokenizer(QString input);
QString pop();
@@ -82,7 +82,7 @@ private:
};
class JsonDbQuery;
-class QueryTerm {
+class Q_JSONDB_PARTITION_EXPORT QueryTerm {
public:
QueryTerm(const JsonDbQuery *query);
~QueryTerm();
@@ -143,7 +143,7 @@ private:
QList<QueryTerm> mTerms;
};
-class OrderTerm {
+class Q_JSONDB_PARTITION_EXPORT OrderTerm {
public:
OrderTerm();
~OrderTerm();
@@ -151,7 +151,7 @@ public:
QString propertyName;
};
-class JsonDbQuery {
+class Q_JSONDB_PARTITION_EXPORT JsonDbQuery {
public:
JsonDbQuery() { }
JsonDbQuery(const QList<OrQueryTerm> &qt, const QList<OrderTerm> &ot);
@@ -181,7 +181,7 @@ private:
typedef QList<QJsonValue> QJsonValueList;
typedef QList<QJsonObject> QJsonObjectList;
typedef QList<JsonDbObject> JsonDbObjectList;
-class JsonDbQueryResult {
+class Q_JSONDB_PARTITION_EXPORT JsonDbQueryResult {
public:
JsonDbObjectList data;
QJsonValue length;
@@ -194,7 +194,7 @@ public:
static JsonDbQueryResult makeErrorResponse(JsonDbError::ErrorCode, const QString&, bool silent=false);
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbreducedefinition.cpp b/src/partition/jsondbreducedefinition.cpp
index 45e84783..ded9357e 100644
--- a/src/daemon/jsondbreducedefinition.cpp
+++ b/src/partition/jsondbreducedefinition.cpp
@@ -50,8 +50,8 @@
#include <stdlib.h>
#include "jsondbpartition.h"
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include "jsondbproxy.h"
#include "jsondbsettings.h"
@@ -60,7 +60,7 @@
#include "jsondbscriptengine.h"
#include "jsondbview.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbReduceDefinition::JsonDbReduceDefinition(const JsonDbOwner *owner, JsonDbPartition *partition,
QJsonObject definition, QObject *parent) :
@@ -354,4 +354,6 @@ QJsonValue JsonDbReduceDefinition::sourceKeyValue(const JsonDbObject &object)
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbreducedefinition.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbreducedefinition.h b/src/partition/jsondbreducedefinition.h
index 0a3d8030..8b063338 100644
--- a/src/daemon/jsondbreducedefinition.h
+++ b/src/partition/jsondbreducedefinition.h
@@ -45,7 +45,7 @@
#include <QJSEngine>
#include <QStringList>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include <qjsonarray.h>
#include <qjsonobject.h>
#include <qjsonvalue.h>
@@ -55,7 +55,7 @@
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbOwner;
class JsonDbJoinProxy;
@@ -120,7 +120,7 @@ private:
QStringList mSourceKeyNameList;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbschemamanager_impl_p.h b/src/partition/jsondbschemamanager_impl_p.h
index 8c49d655..21d03746 100644
--- a/src/daemon/jsondbschemamanager_impl_p.h
+++ b/src/partition/jsondbschemamanager_impl_p.h
@@ -45,7 +45,7 @@
#include "jsondbschemamanager_p.h"
#include "schema-validation/object.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
bool JsonDbSchemaManager::contains(const QString &name) const
{
@@ -103,6 +103,6 @@ inline QJsonObject JsonDbSchemaManager::validate(const QString &schemaName, Json
return callbacks.error();
}
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
#endif // JSONDB_SCHEMA_MANAGER_IMPL_P_H
diff --git a/src/daemon/jsondbschemamanager_p.h b/src/partition/jsondbschemamanager_p.h
index 0e90a978..18958c27 100644
--- a/src/daemon/jsondbschemamanager_p.h
+++ b/src/partition/jsondbschemamanager_p.h
@@ -42,7 +42,7 @@
#ifndef JSONDB_SCHEMA_MANAGER_P_H
#define JSONDB_SCHEMA_MANAGER_P_H
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include <QtCore/qstring.h>
#include <QtCore/qpair.h>
@@ -52,7 +52,7 @@
#include "jsondbobjecttypes_p.h"
#include "jsondbobject.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
//FIXME This can have better performance
class JsonDbSchemaManager
@@ -73,6 +73,6 @@ private:
QMap<QString, QJsonObjectSchemaPair> m_schemas;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
#endif // JSONDB_SCHEMA_MANAGER_P_H
diff --git a/src/daemon/jsondbscriptengine.cpp b/src/partition/jsondbscriptengine.cpp
index bfccadff..e4c80967 100644
--- a/src/daemon/jsondbscriptengine.cpp
+++ b/src/partition/jsondbscriptengine.cpp
@@ -49,11 +49,11 @@
#include <qjsondocument.h>
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
#include "jsondbproxy.h"
#include "jsondbscriptengine.h"
-QT_ADDON_JSONDB_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
QJsonValue JsonDbScriptEngine::fromJSValue(const QJSValue &v)
{
@@ -133,4 +133,4 @@ QJSEngine *JsonDbScriptEngine::scriptEngine()
return sScriptEngine;
}
-QT_ADDON_JSONDB_END_NAMESPACE
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbscriptengine.h b/src/partition/jsondbscriptengine.h
index 8d897959..663a38fc 100644
--- a/src/daemon/jsondbscriptengine.h
+++ b/src/partition/jsondbscriptengine.h
@@ -49,11 +49,11 @@
#include <qjsonobject.h>
#include <qjsonvalue.h>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
QT_BEGIN_HEADER
-QT_ADDON_JSONDB_BEGIN_NAMESPACE
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbScriptEngine : public QObject
{
@@ -68,7 +68,8 @@ public:
static QJSEngine *scriptEngine();
};
-QT_ADDON_JSONDB_END_NAMESPACE
+QT_END_NAMESPACE_JSONDB_PARTITION
+
QT_END_HEADER
#endif // JSONDB_OBJECT_H
diff --git a/src/daemon/jsondbsettings.cpp b/src/partition/jsondbsettings.cpp
index 50b936ba..44343cea 100644
--- a/src/daemon/jsondbsettings.cpp
+++ b/src/partition/jsondbsettings.cpp
@@ -45,7 +45,7 @@
#include <QMetaObject>
#include <QMetaProperty>
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
Q_GLOBAL_STATIC(JsonDbSettings, staticInstance)
@@ -104,4 +104,6 @@ JsonDbSettings *JsonDbSettings::instance()
return staticInstance();
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbsettings.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbsettings.h b/src/partition/jsondbsettings.h
index 9980d4dc..19ee5422 100644
--- a/src/daemon/jsondbsettings.h
+++ b/src/partition/jsondbsettings.h
@@ -42,18 +42,18 @@
#ifndef JSONDB_SETTINGS_H
#define JSONDB_SETTINGS_H
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include <QObject>
#include <QStringList>
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
#define jsondbSettings JsonDbSettings::instance()
-class JsonDbSettings : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbSettings : public QObject
{
Q_OBJECT
Q_PROPERTY(bool rejectStaleUpdates READ rejectStaleUpdates WRITE setRejectStaleUpdates)
@@ -134,7 +134,7 @@ private:
QStringList mConfigSearchPath;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/daemon/jsondbstat.h b/src/partition/jsondbstat.h
index 7fb76263..f2d6f7ac 100644
--- a/src/daemon/jsondbstat.h
+++ b/src/partition/jsondbstat.h
@@ -42,11 +42,13 @@
#ifndef JSONDB_STAT_H
#define JSONDB_STAT_H
+#include "jsondbpartitionglobal.h"
+
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
-class JsonDbStat
+class Q_JSONDB_PARTITION_EXPORT JsonDbStat
{
public:
qint32 reads;
@@ -70,7 +72,7 @@ public:
};
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/common/jsondb-strings.cpp b/src/partition/jsondbstrings.cpp
index c39821c8..661b941b 100644
--- a/src/common/jsondb-strings.cpp
+++ b/src/partition/jsondbstrings.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "jsondb-strings.h"
+#include "jsondbstrings.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
const QString JsonDbString::kUuidStr = QString::fromLatin1("_uuid");
const QString JsonDbString::kVersionStr = QString::fromLatin1("_version");
@@ -115,4 +115,4 @@ const QString JsonDbString::kDatabaseSchemaVersionStr = QString::fromLatin1("dat
const QString JsonDbString::kPathStr = QString::fromLatin1("path");
const QString JsonDbString::kDefaultStr = QString::fromLatin1("default");
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/partition/jsondbstrings.h b/src/partition/jsondbstrings.h
new file mode 100644
index 00000000..60fb7c23
--- /dev/null
+++ b/src/partition/jsondbstrings.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtAddOn.JsonDb module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JSONDB_STRINGS_H
+#define JSONDB_STRINGS_H
+
+#include <QString>
+#include "jsondbpartitionglobal.h"
+
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
+
+class Q_JSONDB_PARTITION_EXPORT JsonDbString {
+public:
+ static const QString kActionStr;
+ static const QString kActionsStr;
+ static const QString kActiveStr;
+ static const QString kAddIndexStr;
+ static const QString kCodeStr;
+ static const QString kConflictsStr;
+ static const QString kConnectStr;
+ static const QString kCountStr;
+ static const QString kCreateStr;
+ static const QString kDropStr;
+ static const QString kCurrentStr;
+ static const QString kDataStr;
+ static const QString kDeletedStr;
+ static const QString kDisconnectStr;
+ static const QString kDomainStr;
+ static const QString kErrorStr;
+ static const QString kExplanationStr;
+ static const QString kFieldNameStr;
+ static const QString kFindStr;
+ static const QString kNameStr;
+ static const QString kIdStr;
+ static const QString kIndexValueStr;
+ static const QString kLengthStr;
+ static const QString kLimitStr;
+ static const QString kMapTypeStr;
+ static const QString kMessageStr;
+ static const QString kMetaStr;
+ static const QString kNotifyStr;
+ static const QString kNotificationTypeStr;
+ static const QString kObjectStr;
+ static const QString kParentStr;
+ static const QString kOffsetStr;
+ static const QString kOwnerStr;
+ static const QString kQueryStr;
+ static const QString kReduceTypeStr;
+ static const QString kRemoveStr;
+ static const QString kResultStr;
+ static const QString kSchemaStr;
+ static const QString kSchemaTypeStr;
+ static const QString kTypeStr;
+ static const QString kTypesStr;
+ static const QString kUpdateStr;
+ static const QString kUuidStr;
+ static const QString kVersionStr;
+ static const QString kViewTypeStr;
+ static const QString kTokenStr;
+ static const QString kFlushStr;
+ static const QString kSettingsStr;
+ static const QString kChangesSinceStr;
+ static const QString kStateNumberStr;
+ static const QString kCollapsedStr;
+ static const QString kCurrentStateNumberStr;
+ static const QString kStartingStateNumberStr;
+ static const QString kTombstoneStr;
+ static const QString kPartitionTypeStr;
+ static const QString kPartitionStr;
+ static const QString kLogStr;
+ static const QString kPropertyNameStr;
+ static const QString kPropertyTypeStr;
+ static const QString kPropertyFunctionStr;
+ static const QString kObjectTypeStr;
+ static const QString kDbidTypeStr;
+ static const QString kIndexTypeStr;
+ static const QString kLocaleStr;
+ static const QString kCollationStr;
+ static const QString kCaseSensitiveStr;
+ static const QString kCasePreferenceStr;
+ static const QString kDatabaseSchemaVersionStr;
+ static const QString kPathStr;
+ static const QString kDefaultStr;
+};
+
+QT_END_NAMESPACE_JSONDB_PARTITION
+
+#endif /* JSONDB-STRINGS_H */
diff --git a/src/daemon/jsondbview.cpp b/src/partition/jsondbview.cpp
index acc08e44..0c862b5d 100644
--- a/src/daemon/jsondbview.cpp
+++ b/src/partition/jsondbview.cpp
@@ -46,7 +46,6 @@
#include <QString>
#include <QElapsedTimer>
-#include "jsondb-global.h"
#include "jsondbpartition.h"
#include "jsondbobject.h"
#include "jsondbview.h"
@@ -56,7 +55,7 @@
#include "jsondbsettings.h"
#include "jsondbscriptengine.h"
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
JsonDbView::JsonDbView(JsonDbPartition *partition, const QString &viewType, QObject *parent) :
QObject(parent)
@@ -85,8 +84,7 @@ void JsonDbView::open()
if (!mViewObjectTable->open(QString("%1/%2-%3-View.db")
.arg(dirName)
.arg(baseName)
- .arg(mViewType),
- QBtree::NoSync | QBtree::UseSyncMarker)) {
+ .arg(mViewType))) {
qCritical() << "viewDb->open" << mViewObjectTable->errorMessage();
return;
}
@@ -535,4 +533,6 @@ bool JsonDbView::isActive() const
return false;
}
-QT_END_NAMESPACE_JSONDB
+#include "moc_jsondbview.cpp"
+
+QT_END_NAMESPACE_JSONDB_PARTITION
diff --git a/src/daemon/jsondbview.h b/src/partition/jsondbview.h
index 6dc656a5..70a1bda4 100644
--- a/src/daemon/jsondbview.h
+++ b/src/partition/jsondbview.h
@@ -45,19 +45,19 @@
#include <QObject>
#include <QString>
-#include "jsondb-global.h"
+#include "jsondbpartitionglobal.h"
#include "jsondbmapdefinition.h"
#include "jsondbreducedefinition.h"
QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE_JSONDB
+QT_BEGIN_NAMESPACE_JSONDB_PARTITION
class JsonDbOwner;
class JsonDbPartition;
class JsonDbObjectTable;
-class JsonDbView : public QObject
+class Q_JSONDB_PARTITION_EXPORT JsonDbView : public QObject
{
Q_OBJECT
public:
@@ -116,7 +116,7 @@ private:
friend class JsonDbReduceDefinition;
};
-QT_END_NAMESPACE_JSONDB
+QT_END_NAMESPACE_JSONDB_PARTITION
QT_END_HEADER
diff --git a/src/partition/partition.pro b/src/partition/partition.pro
new file mode 100644
index 00000000..1073f370
--- /dev/null
+++ b/src/partition/partition.pro
@@ -0,0 +1,80 @@
+TEMPLATE = lib
+TARGET = $$QT.jsondbpartition.name
+MODULE = jsondbpartition
+
+load(qt_module)
+load(qt_module_config)
+
+DESTDIR = $$QT.jsondbpartition.libs
+VERSION = $$QT.jsondbpartition.VERSION
+DEFINES += QT_JSONDB_PARTITION_LIB
+
+QT = core network qml
+
+CONFIG += module create_prl
+MODULE_PRI = ../../modules/qt_jsondbpartition.pri
+
+include(../3rdparty/btree/btree.pri)
+include(../common/common.pri)
+
+RESOURCES = jsondb.qrc
+
+HEADERS += \
+ jsondbowner.h \
+ jsondbproxy.h \
+ jsondbindex.h \
+ jsondbobject.h \
+ jsondbpartition.h \
+ jsondbquery.h \
+ jsondbstat.h \
+ jsondbview.h \
+ jsondbmapdefinition.h \
+ jsondbnotification.h \
+ jsondbobjectkey.h \
+ jsondbobjecttable.h \
+ jsondbmanagedbtree.h \
+ jsondbmanagedbtreetxn.h \
+ jsondbobjecttypes_impl_p.h \
+ jsondbobjecttypes_p.h \
+ jsondbreducedefinition.h \
+ schema-validation/checkpoints.h \
+ schema-validation/object.h \
+ jsondbschemamanager_impl_p.h \
+ jsondbschemamanager_p.h \
+ jsondbscriptengine.h \
+ jsondbsettings.h \
+ jsondbindexquery.h \
+ jsondberrors.h \
+ jsondbstrings.h \
+ jsondbpartitionglobal.h \
+ jsondbcollator.h \
+ jsondbcollator_p.h
+
+SOURCES += \
+ jsondbowner.cpp \
+ jsondbproxy.cpp \
+ jsondbindex.cpp \
+ jsondbobject.cpp \
+ jsondbpartition.cpp \
+ jsondbquery.cpp \
+ jsondbview.cpp \
+ jsondbmapdefinition.cpp \
+ jsondbnotification.cpp \
+ jsondbobjecttable.cpp \
+ jsondbmanagedbtree.cpp \
+ jsondbmanagedbtreetxn.cpp \
+ jsondbreducedefinition.cpp \
+ jsondbscriptengine.cpp \
+ jsondbsettings.cpp \
+ jsondbindexquery.cpp \
+ jsondberrors.cpp \
+ jsondbstrings.cpp \
+ jsondbcollator.cpp
+
+mac:QMAKE_FRAMEWORK_BUNDLE_NAME = $$QT.jsondbpartition.name
+
+unix:!mac:contains(QT_CONFIG,icu) {
+ LIBS += -licuuc -licui18n
+} else {
+ DEFINES += NO_COLLATION_SUPPORT
+}
diff --git a/src/daemon/schema-validation/checkpoints.h b/src/partition/schema-validation/checkpoints.h
index 34e2e164..34e2e164 100644
--- a/src/daemon/schema-validation/checkpoints.h
+++ b/src/partition/schema-validation/checkpoints.h
diff --git a/src/daemon/schema-validation/object.h b/src/partition/schema-validation/object.h
index 2725647e..2725647e 100644
--- a/src/daemon/schema-validation/object.h
+++ b/src/partition/schema-validation/object.h
diff --git a/src/daemon/schema/Capability.json b/src/partition/schema/Capability.json
index 27f49859..27f49859 100644
--- a/src/daemon/schema/Capability.json
+++ b/src/partition/schema/Capability.json
diff --git a/src/daemon/schema/Index.json b/src/partition/schema/Index.json
index 7c60d153..7c60d153 100644
--- a/src/daemon/schema/Index.json
+++ b/src/partition/schema/Index.json
diff --git a/src/daemon/schema/RootCapability.json b/src/partition/schema/RootCapability.json
index 9d4869fa..9d4869fa 100644
--- a/src/daemon/schema/RootCapability.json
+++ b/src/partition/schema/RootCapability.json
diff --git a/src/daemon/schema/View.json b/src/partition/schema/View.json
index 6130fa33..6130fa33 100644
--- a/src/daemon/schema/View.json
+++ b/src/partition/schema/View.json
diff --git a/src/daemon/schema/notification.json b/src/partition/schema/notification.json
index 360be3b2..360be3b2 100644
--- a/src/daemon/schema/notification.json
+++ b/src/partition/schema/notification.json
diff --git a/src/src.pro b/src/src.pro
index 33992b82..ae3b872a 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
CONFIG += ordered
-SUBDIRS += 3rdparty jsonstream clientcompat client daemon imports
+SUBDIRS += 3rdparty jsonstream clientcompat partition client daemon imports
diff --git a/sync.profile b/sync.profile
index 218659e3..e2b395c0 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,5 +1,6 @@
%modules = ( # path to module name map
"QtJsonDb" => "$basedir/src/client",
+ "QtJsonDbPartition" => "$basedir/src/partition",
"QtJsonDbCompat" => "$basedir/src/clientcompat",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
@@ -14,6 +15,7 @@
);
%modulepris = (
"QtJsonDb" => "$basedir/modules/qt_jsondb.pri",
+ "QtJsonDbPartition" => "$basedir/modules/qt_jsondbpartition.pri",
"QtJsonDbCompat" => "$basedir/modules/qt_jsondbcompat.pri",
);
$publicclassregexp = "QJsonDb.+";
diff --git a/tests/auto/accesscontrol/accesscontrol.pro b/tests/auto/accesscontrol/accesscontrol.pro
index e15c1c62..83bfadfc 100644
--- a/tests/auto/accesscontrol/accesscontrol.pro
+++ b/tests/auto/accesscontrol/accesscontrol.pro
@@ -1,16 +1,14 @@
TARGET = tst_accesscontrol
CONFIG += debug
-QT = network qml testlib
+QT = network qml testlib jsondbpartition
CONFIG -= app_bundle
CONFIG += testcase
-INCLUDEPATH += $$PWD/../../../src/daemon
LIBS += -L$$QT.jsondb.libs
DEFINES += SRCDIR=\\\"$$PWD/\\\"
-include($$PWD/../../../src/daemon/daemon.pri)
RESOURCES+= accesscontrol.qrc
SOURCES += \
testjsondb.cpp \
diff --git a/tests/auto/accesscontrol/testjsondb.cpp b/tests/auto/accesscontrol/testjsondb.cpp
index b88d5d59..3f18ff58 100644
--- a/tests/auto/accesscontrol/testjsondb.cpp
+++ b/tests/auto/accesscontrol/testjsondb.cpp
@@ -52,7 +52,7 @@
#include "../../shared/util.h"
-QT_USE_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
/*
Ensure that a good result object contains the correct fields
diff --git a/tests/auto/daemon/daemon.pro b/tests/auto/daemon/daemon.pro
index ec251ea2..555d9fd2 100644
--- a/tests/auto/daemon/daemon.pro
+++ b/tests/auto/daemon/daemon.pro
@@ -1,16 +1,20 @@
TARGET = tst_daemon
CONFIG += debug
-QT = network qml testlib
+QT = network qml testlib jsondbpartition
CONFIG -= app_bundle
CONFIG += testcase
-INCLUDEPATH += $$PWD/../../../src/daemon
LIBS += -L$$QT.jsondb.libs
DEFINES += SRCDIR=\\\"$$PWD/\\\"
-include($$PWD/../../../src/daemon/daemon.pri)
+unix:!mac:contains(QT_CONFIG,icu) {
+ LIBS += -licuuc -licui18n
+} else {
+ DEFINES += NO_COLLATION_SUPPORT
+}
+
RESOURCES += json-validation.qrc daemon.qrc
SOURCES += \
diff --git a/tests/auto/daemon/testjsondb.cpp b/tests/auto/daemon/testjsondb.cpp
index 30fde793..e4eb6d30 100644
--- a/tests/auto/daemon/testjsondb.cpp
+++ b/tests/auto/daemon/testjsondb.cpp
@@ -54,8 +54,8 @@
#include "jsondbpartition.h"
#include "jsondbindex.h"
#include "jsondbsettings.h"
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include <qjsonobject.h>
@@ -67,7 +67,7 @@
#define DBG() if (0) qDebug()
#endif
-QT_USE_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
static QString kContactStr = "com.example.unittest.contact";
@@ -4214,7 +4214,7 @@ void TestJsonDb::managedBtree()
QFile::remove(mdbname);
QScopedPointer<JsonDbManagedBtree> mdb(new JsonDbManagedBtree);
- if (!mdb->open(mdbname, QBtree::NoSync))
+ if (!mdb->open(mdbname))
Q_ASSERT(false);
for (int i = 0; i < numtags; ++i) {
diff --git a/tests/auto/queries/queries.pro b/tests/auto/queries/queries.pro
index 620406bc..7a3a89ac 100644
--- a/tests/auto/queries/queries.pro
+++ b/tests/auto/queries/queries.pro
@@ -1,16 +1,13 @@
TARGET = tst_queries
-QT = network qml testlib
+QT = network qml testlib jsondbpartition
CONFIG -= app_bundle
CONFIG += testcase
-INCLUDEPATH += $$PWD/../../../src/daemon
LIBS += -L$$QT.jsondb.libs
DEFINES += SRCDIR=\\\"$$PWD/\\\"
-include($$PWD/../../../src/daemon/daemon.pri)
-
RESOURCES = queries.qrc
SOURCES += \
diff --git a/tests/auto/queries/testjsondbqueries.cpp b/tests/auto/queries/testjsondbqueries.cpp
index 0541adc9..3e9837c8 100644
--- a/tests/auto/queries/testjsondbqueries.cpp
+++ b/tests/auto/queries/testjsondbqueries.cpp
@@ -51,8 +51,8 @@
#include "jsondbowner.h"
#include "jsondbpartition.h"
#include "jsondbquery.h"
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include "../../shared/util.h"
@@ -70,7 +70,7 @@
__result.error.toObject().value("message").toString().toLocal8Bit()); \
}
-QT_USE_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
class TestJsonDbQueries: public QObject
{
diff --git a/tests/benchmarks/daemon/bench_daemon.cpp b/tests/benchmarks/daemon/bench_daemon.cpp
index 29aa1a57..1beca5ef 100644
--- a/tests/benchmarks/daemon/bench_daemon.cpp
+++ b/tests/benchmarks/daemon/bench_daemon.cpp
@@ -51,14 +51,14 @@
#include "jsondbindex.h"
#include "jsondbindexquery.h"
#include "jsondbsettings.h"
-#include "jsondb-strings.h"
-#include "jsondb-error.h"
+#include "jsondbstrings.h"
+#include "jsondberrors.h"
#include <qjsonobject.h>
#include "../../shared/util.h"
-QT_USE_NAMESPACE_JSONDB
+QT_USE_NAMESPACE_JSONDB_PARTITION
Q_DECLARE_METATYPE(QJsonArray)
Q_DECLARE_METATYPE(QJsonObject)
diff --git a/tests/benchmarks/daemon/daemon.pro b/tests/benchmarks/daemon/daemon.pro
index a76caafa..48afdcce 100644
--- a/tests/benchmarks/daemon/daemon.pro
+++ b/tests/benchmarks/daemon/daemon.pro
@@ -1,14 +1,13 @@
TARGET = tst_bench_daemon
-QT = network qml testlib
+QT = network qml testlib jsondbpartition
CONFIG -= app_bundle
CONFIG += testcase
-INCLUDEPATH += $$PWD/../../../src/daemon
LIBS += -L$$QT.jsondb.libs
DEFINES += SRCDIR=\\\"$$PWD/\\\"
-include($$PWD/../../../src/daemon/daemon.pri)
+
RESOURCES+=../../json.qrc daemon.qrc
SOURCES += \
bench_daemon.cpp \